package com.example.myapp;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.Button;
import android.widget.ImageView;

import com.google.android.material.snackbar.BaseTransientBottomBar;

import java.sql.BatchUpdateException;

public class AnimationActivity extends AppCompatActivity implements View.OnClickListener{
    private Button btone,bttwo,btthree,btfour;
    private ImageView twbean;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_animation);
        btone=(Button)findViewById(R.id.bti_change);
        bttwo=(Button)findViewById(R.id.bti_rote);
        btthree=(Button)findViewById(R.id.bti_scal);
        btfour=(Button)findViewById(R.id.bti_move);
        twbean=(ImageView)findViewById(R.id.twimage);
        btone.setOnClickListener(this);
        bttwo.setOnClickListener(this);
        btthree.setOnClickListener(this);
        btfour.setOnClickListener(this);
    }
    public void onClick(View v){
        switch (v.getId()){
            case R.id.bti_change:
                Animation alpha= AnimationUtils.loadAnimation(this,R.anim.alpha_animation);
                twbean.startAnimation(alpha);
                break;
            case R.id.bti_rote:
                Animation rote= AnimationUtils.loadAnimation(this,R.anim.rotate_animation);
                twbean.startAnimation(rote);
                break;
            case R.id.bti_scal:
                Animation scale= AnimationUtils.loadAnimation(this,R.anim.scale_animation);
                twbean.startAnimation(scale);
                break;
            case R.id.bti_move:
                Animation translate= AnimationUtils.loadAnimation(this,R.anim.translate_animation);
                twbean.startAnimation(translate);
                break;
        }
    }
}